<?
class graphStorageUsage  extends graphBase {
	public function __construct($device,$params=array()) {
		if (is_array($params) || is_object($params)) {
			foreach ($params AS $name=>$value) {
				switch ($name) {
					case 'index': 
						$this->rrdFile = 'storage_'.(int)$value.'.rrd';
						break;
				}
			}
		}
		parent::__construct($device,$params);
	}
	
	protected function getOptions() {
		return array(
			'--lower-limit',0,
			'--upper-limit',100,
			'DEF:used='.$this->rrdPath.':used:AVERAGE',
			'DEF:size='.$this->rrdPath.':size:AVERAGE',
			'DEF:perc='.$this->rrdPath.':perc:AVERAGE',
			'CDEF:free=size,used,-',
			'LINE1.25:perc#f00:Used','GPRINT:size:LAST:%6.2lf%SB','GPRINT:used:LAST: %6.2lf%SB','GPRINT:perc:LAST:      %5.2lf%%\n',
			'COMMENT:             Size       Used    Percentage\n'
		);
	}
}